#ifndef CHARACTER_H_
#define CHARACTER_H_

#include "game_status.h"
#include "raylib.h"

enum CharacterStatusEnum
{
    IDEL = 1 << 0,
    HIT = 1 << 1,
    RUN_RIGHT = 1 << 2,
    RUN_LEFT = 1 << 3,
    JUMP = 1 << 4,
    DOUBLE_JUMP = 1 << 5,
    WALL_JUMP = 1 << 6,
    FALL = 1 << 7,
};

class Character
{
  public:
    Character();
    Character(Character &&) = default;
    Character(const Character &) = default;
    Character &operator=(Character &&) = default;
    Character &operator=(const Character &) = default;
    ~Character();

    void Draw();
    void EventHandler(GameStatus *gameStatus);
    Vector2 GetLTP();
    Vector2 GetLBP();
    Vector2 GetRTP();
    Vector2 GetRBP();
    Vector2 GetBMP();

  private:
    // base
    int status;
    float x, y;
    float width;
    float height;
    float jumpOldY;

    // double jump
    Texture2D doubleJumpTexture;
    float doubleJumpSpeed;
    float doubleJumpWidth;
    float doubleJumpHeight;
    int doubleJumpCount;
    float doubleJumpMaxHeight;
    int doubleJumpTextureNum;
    int doubleJumpFrameSpeed;
    int doubleJumpCurrentFrame;
    float doubleJumpFrameCounter;

    // fall
    Texture2D fallTexture;
    float fallSpeed;

    Texture2D hitTexture;

    // idel
    Texture2D idleTexture;
    int idleTextureNum;
    int idleFrameSpeed;
    int idleCurrentFrame;
    float idleFrameCounter;

    // jump
    Texture2D jumpTexture;
    float jumpSpeed;
    float jumpMaxHeight;

    // run
    Texture2D runTexture;
    float runSpeed;
    float runTextureWidth;
    float runTextureHeight;
    int runTextureNum;
    int runFrameSpeed;
    int runCurrentFrame;
    float runFrameCounter;

    Texture2D wallJumpTexture;

    void checkPosition();
};

#endif // !CHARACTER_H_